package org.cytoscape.cytargetlinker.internal.model;

import java.awt.Color;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.cytoscape.model.CyEdge;
import org.cytoscape.model.CyNode;

/**
 * data object of a regulatory interaction network
 * contains regulatory interactions
 */
public class RegNet implements Comparable<RegNet> {

	private File file;
	private String name;
	private Color color;
	
	private Integer newInteractions;
	private List<Edge> edges;
	private String edgeType;
	private List<CyNode> cyNodes;
	private List<CyEdge> cyEdges;
	
	// networks can be shown or hidden
	private boolean hidden = false;
	private List<CyNode> hiddenNodes;
	private List<CyEdge> hiddenEdges;

	// used to store the coordinates of nodes to be able to restore them
	private Map<Long, Double> xPosition; 
    private Map<Long, Double> yPosition; 
	
    public RegNet() {
    	edges = new ArrayList<Edge>();
    	cyNodes = new ArrayList<CyNode>();
    	cyEdges = new ArrayList<CyEdge>();
    	hiddenNodes = new ArrayList<CyNode>();
    	hiddenEdges = new ArrayList<CyEdge>();
    	xPosition = new HashMap<Long, Double>();
    	yPosition = new HashMap<Long, Double>();
    }
    
    /**
	 * orders the RINs based on the number of new interactions
	 */
	@Override
	public int compareTo(RegNet regNet) {
		return regNet.getNewInteractions().compareTo(getNewInteractions());
	}
	
	// SETTERS & GETTERS

	public File getFile() {
		return file;
	}

	public void setFile(File file) {
		this.file = file;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Color getColor() {
		return color;
	}

	public void setColor(Color color) {
		this.color = color;
	}

	public Integer getNewInteractions() {
		return newInteractions;
	}

	public void setNewInteractions(Integer newInteractions) {
		this.newInteractions = newInteractions;
	}

	public List<Edge> getEdges() {
		return edges;
	}

	public void setEdges(List<Edge> edges) {
		this.edges = edges;
	}

	public String getEdgeType() {
		return edgeType;
	}

	public void setEdgeType(String edgeType) {
		this.edgeType = edgeType;
	}

	public List<CyNode> getCyNodes() {
		return cyNodes;
	}

	public void setCyNodes(List<CyNode> cyNodes) {
		this.cyNodes = cyNodes;
	}

	public List<CyEdge> getCyEdges() {
		return cyEdges;
	}

	public void setCyEdges(List<CyEdge> cyEdges) {
		this.cyEdges = cyEdges;
	}

	public boolean isHidden() {
		return hidden;
	}

	public void setHidden(boolean hidden) {
		this.hidden = hidden;
	}

	public List<CyNode> getHiddenNodes() {
		return hiddenNodes;
	}

	public void setHiddenNodes(List<CyNode> hiddenNodes) {
		this.hiddenNodes = hiddenNodes;
	}

	public List<CyEdge> getHiddenEdges() {
		return hiddenEdges;
	}

	public void setHiddenEdges(List<CyEdge> hiddenEdges) {
		this.hiddenEdges = hiddenEdges;
	}

	public Map<Long, Double> getxPosition() {
		return xPosition;
	}

	public void setxPosition(Map<Long, Double> xPosition) {
		this.xPosition = xPosition;
	}

	public Map<Long, Double> getyPosition() {
		return yPosition;
	}

	public void setyPosition(Map<Long, Double> yPosition) {
		this.yPosition = yPosition;
	}
}
